/**
 * <p>显示数据的grid</p>
 * xtype = cceafstore

 * @module Ext-ux-cceaf-data
 * @class cceaf.data.Store
 * @extends Ext.data.Store
 * @since 1.0
 */
Ext.define('cceaf.data.Store',{
	extend: 'Ext.data.Store', 
    alias: 'widget.cceafstore',
    
    constructor: function(config){
		config = config || {};
		
		var model;
		if (config.model) {
			model = config.model;
		} else {
			cceaf.util.ExtHelper.showInfoDialog('请设置model!');
			return;
		}
		
		config = Ext.apply(config || {}, {
			model: model,
			
			proxy: {
	    		type: 'ajax',
	    		url: config.action,
	    		reader: {
					type: 'json',
					root: 'data',
					totalProperty: 'totalCount',
					messageProperty: 'message'
				}
			},
			
	        listeners: {
	        	'load': function(){
	        		var jr = this.getProxy().getReader();
	        		var message = jr.jsonData.message;
	        		var url = jr.jsonData.url;
	        		cceaf.util.ExtHelper.showInfoDialog(message,url);
	        	},
	        	'loadexception': function(){
	        		var jr = ds.getProxy().getReader();
	        		if(jr.jsonData){
		        		var message = jr.jsonData.message;
		        		var url = jr.jsonData.url;
		        		cceaf.util.ExtHelper.showErrorDialog(message,url);
	        		}
	        		else{
	        			cceaf.util.ExtHelper.showErrorDialog("返回无效的JSONDATA数据");
	        		}
	        	}
	        },
	        
	        autoDestroy: true,  
	    	pageSize: szpshang.Global.PAGE_SIZE
		});

		cceaf.data.Store.superclass.constructor.apply(this, arguments);
	},
	
	/**
	 * 获取数据的action
	 *
     * @property action 
     * @type String
     * @default null
     */
	action: null
	
});